﻿using System;
using System.Collections.Generic;
using System.Data.OleDb;
using System.Linq;
using System.Text;

namespace VIFON.DAL
{
    public class DABillDetail
    {
        /// <summary>
        /// Delete billdetails by bill
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        internal bool Delete(int id)
        {
            try
            {
                using (var db = new DBVIFONDataContext())
                {
                    var temp = db.BillDetails.FirstOrDefault(o => o.BillId == id);
                    if (temp == null)
                        return false;
                    db.BillDetails.DeleteOnSubmit(temp);
                    db.SubmitChanges();
                    return true;
                }
            }
            catch
            {
                return false;
            }
        }
    }
}
